<?php
require_once 'dal/ConnectionFactory.php';
print_r(PDO::getAvailableDrivers());
	try {  
		# MySQL with PDO_MYSQL  
		$DBH = ConnectionFactory::getInstance()->open();
		$DBH->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
		# exec simple query
		# using the shortcut ->query() method here since there are no variable  
		# values in the select statement.  
		#$STH = $DBH->query('SELECT firstname, lastname, cityname FROM person INNER JOIN city USING (postcode)');
		$id = 1;
		$STH = $DBH->prepare("SELECT * FROM person WHERE personid = :id");
		$STH->bindParam(":id",$id);  
		# setting the fetch mode  
		$STH->setFetchMode(PDO::FETCH_ASSOC);  
			
		while($row = $STH->fetch()) {  
				echo $row['firstname'] . "\n";  
				echo $row['lastname'] . "\n";  
				echo $row['cityname'] . "\n";
				echo "----------------------------\n";  
		}
		ConnectionFactory::getInstance()->release($DBH);
		echo "<< closed\n";
	} catch(PDOException $e) {
			echo "!! failed" . $e->getMessage() . "\n";
	}
?>